Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to containerize the app for Docker #47

Merged
merged 1 commit into from
Apr 28, 2017

Conversation

leeallen337
Copy link
Contributor

@leeallen337 leeallen337 commented Apr 22, 2017

WHY?

The official docker NodeJS images include yarn so there is no longer a need to install it in the Dockerfile
References:

WHAT?

  • Remove the installation of yarn in the `Dockerfile (it's included in the Node images now)
  • The previous Dockerfile would only work when you were running the service with docker-compose since you had a shared volume between your host machine and the container, but if you just tried to build the image and then tried to run it it would fail because in the build process no source code was moved into the container.
  • Switched the node image to the latest LTS slim image.
  • It's best practice to have the apt-get update and apt-get install on the same line concatenated with && to take advantage of docker caching and proper cache-busting. Refer to the Run section here.
  • Now you can develop without having to install anything locally (e.g. node_modules, node, yarn, etc.) except maybe git and a text editor.
  • Added comments for clarity.

Copy link
Contributor

@zachary-kuhn zachary-kuhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is neat. Really awesome stuff. I think we can remove even that line, which means maybe we don't need a Dockerfile and can instead just rely on docker-compose.

Dockerfile Outdated

RUN apt-get update
RUN apt-get install yarn
RUN apt-get update && apt-get install apt-transport-https
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should no longer need this line because apt-transport-https is purely for getting yarn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zachary-kuhn You're absolutely right haha.

@leeallen337
Copy link
Contributor Author

I'll play around this and look into maybe just having a docker-compose.yml file 👍

@leeallen337
Copy link
Contributor Author

@zachary-kuhn I made some changes. Let me know what you think.

@leeallen337 leeallen337 force-pushed the update/docker-files branch 3 times, most recently from a016d1d to 770d96b Compare April 27, 2017 11:53
@leeallen337 leeallen337 changed the title Updating Dockerfile Updating to containerize the app for Docker Apr 27, 2017
Copy link
Contributor

@mweslander mweslander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't pulled this down and tried it yet, but at first pass it looks good to me.

ports:
- '8080:8080'
- "8080:8080"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this to double quotes and above to single? Will one or the other not work?

Copy link
Contributor Author

@leeallen337 leeallen337 Apr 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe they both work. I came across this SO question/answer when browsing between the difference. However, I ultimately decided on double quotes because in Docker's own documentation they use double. See here

@leeallen337 leeallen337 merged commit c3f9bdc into master Apr 28, 2017
@ghost ghost removed the in progress label Apr 28, 2017
@leeallen337 leeallen337 deleted the update/docker-files branch April 28, 2017 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants